

function xdenoised = wdenoise_NVC_v2(x)


try
    % Decompose Signal using the MODWT
    % Generated by MATLAB(R) 9.6 and Wavelet Toolbox 5.2.
    % Generated on: 14-Mar-2023 10:41:24
    % Logical array for selecting reconstruction elements
    levelForReconstruction = [false, false, true, true, true];
    % Perform the decomposition using modwt
    wt = modwt(x, 'sym4', 4);
    % Construct MRA matrix using modwtmra
    mra = modwtmra(wt, 'sym4');
    % Sum along selected multiresolution signals
    xdenoised = sum(mra(levelForReconstruction,:),1);
catch
    xdenoised = wdenoise(x,1, ...
        Wavelet='sym3', ...
        DenoisingMethod='Bayes', ...
        ThresholdRule='Median', ...
        NoiseEstimate='LevelDependent');
end
